//
//  DownLoadViewController.m
//  XDBaseFrameWork
//
//  Created by XD-XY on 10/2/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "DownLoadViewController.h"

@interface DownLoadViewController ()

@end

@implementation DownLoadViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.titleLabel.text = @"下载原图";
    
    linkString = [[NSString alloc] init];
    
    linkLabel = [UILabel initLabelText:[NSString stringWithFormat:@"百度云链接地址\n%@\n提取密码: %@",self.PhotoUrl,self.PhotoPwd] andRect:CGRectMake(10, 10, 300, 20) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:17] andTextColor:UIColorFromRGB(0x6f6254) andTextAlignment:NSTextAlignmentLeft];
    linkLabel.numberOfLines = 0;
    [linkLabel sizeToFit];
    [self.contentView addSubview:linkLabel];
    
    UIView * line = [UIView initViewRect:CGRectMake(0,height_y(linkLabel)+10, UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0x999999)];
    [self.contentView addSubview:line];
    
    UIButton * copyButton = [UIButton initButton:CGRectMake(100, height_y(line)+10, 120, 40) btnImage:LOADIMAGE(@"xiadan@2x") btnTitle:@"复制链接"];
    [copyButton addTarget:self action:@selector(copyButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:copyButton];

    UIImageView * iv = [UIImageView initImageViewRect:CGRectMake(10, height_y(copyButton)+20, UI_SCREEN_WIDTH-20, UI_SCREEN_HEIGHT-(height_y(copyButton)+20)-10) andImage:nil andUserInteractionEnabled:YES];
    iv.backgroundColor =UIColorFromRGB(0xf5f5f5);
    [self.contentView addSubview:iv];

}

-(void)copyButtonClick
{
    linkString = self.PhotoUrl;
    [[UIPasteboard generalPasteboard] setString:linkString];
    [XDTools showTips:@"已复制到剪切板上" toView:self.view];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
